<?php 
  // no direct access 
  defined( '_JEXEC' ) or die( 'Restricted access' );
  

$leftColumnWidth			= $this->params->get("leftColumnWidth", 20);
$showLeftColumn = $this->countModules('left') > 0;
$leftColumnWidth *= $showLeftColumn;

$rightColumnWidth			= $this->params->get("rightColumnWidth", 20);
$showRightColumn = $this->countModules('right') > 0;
$showRightColumn &= JRequest::getCmd('layout') != 'form';
$showRightColumn &= JRequest::getCmd('task') != 'edit';
$rightColumnWidth *= $showRightColumn;

if (($leftColumnWidth + $rightColumnWidth) > 80)
{
  $rightColumnWidth = 20;
}
if (($leftColumnWidth + $rightColumnWidth) > 80)
{
  $leftColumnWidth = 20;
}

$contentWidth = 100 - $leftColumnWidth - $rightColumnWidth;
$templatePath = '/templates/' . $this->template;

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"\
>

<html xmlns="http://www.w3.org/1999/xhtml" 
      xml:lang="<?php echo $this->language; ?>" 
      lang="<?php echo $this->language; ?>" 
>

  <head>
    <link rel="shortcut icon" href="/templates/<?php echo $this->template ?>/images/favicon.ico" />
    <jdoc:include type="head" />
    <link rel="stylesheet" href="/templates/system/css/system.css" type="text/css" />
    <link rel="stylesheet" href="/templates/system/css/general.css" type="text/css" />
    <link rel="stylesheet" href="<?php echo $templatePath; ?>/css/template.css" type="text/css" />
    <link rel="stylesheet" href="<?php echo $templatePath; ?>/css/wb_menu.css" type="text/css" />
    <link rel="stylesheet" href="<?php echo $templatePath; ?>/css/mn_menu.css" type="text/css" />
    <link rel="stylesheet" href="<?php echo $templatePath; ?>/css/mooRainbow.css" type="text/css" />
    <script type="text/javascript" src="<?php echo $templatePath; ?>/js/mooRainbow.js"></script>    
    <script type="text/javascript" src="<?php echo $templatePath; ?>/js/wb_first.js"></script>    
    <style type="text/css">
    #right
    {
      width:<?php echo $rightColumnWidth ?>%;
    }
    #left
    {
      width:<?php echo $leftColumnWidth ?>%;
    }
    #content
    {
      width:<?php echo $contentWidth ?>%;
    }
    #wrap
    {
      background: <?php echo $this->params->get('wrap_background_color');?>;
    }
    body
    {
      background: <?php echo $this->params->get('border_background_color');?>;
    }
    </style>
  </head>

  <body class="<?php echo $this->params->get('template_width');?> <?php echo $this->params->get('background_style'); ?>">
    <div id="wrap">
    
      <div id="header">
        <div class="inside">
          <img id="logo" src="<?php echo $templatePath ?>/images/wb2.png"/>
          <div id="wbRainbow">
            <label>
              Rainbow 
              <img id="myRainbow" src="<?php echo $templatePath ?>/images/rainbow.png" alt="[r]" width="16" height="16" />
              <input id="myInput" name="myInput" type="text" size="13" />
            </label>
          </div>
          <jdoc:include type="modules" name="header" style="xhtml" />
        </div>
      </div>

      <div style="float:right">
        <div id="top">
          <div class="inside">
            <jdoc:include type="modules" name="top" style="xhtml" />
          </div>
        </div>
      </div>        
    
      <?php if($showLeftColumn) : ?>
      <div id="left" style="clear:both" class="<?php echo $this->params->get("columnLayout", "left-right"); ?>" >
        <div class="inside">
          <jdoc:include type="modules" name="left" style="xhtml" />
        </div>
      </div>
      <?php endif; ?>
      
      <div id="content" class="<?php echo $this->params->get("columnLayout", "left-right"); ?>" > 
        <div class="inside">
          <jdoc:include type="module" name="breadcrumbs" style="none" />
          <jdoc:include type="component" style="xhtml" />
          <jdoc:include type="modules" name="user1" />
        </div>
      </div>
      <?php if ($showRightColumn) : ?>
      <div id="right" class="<?php echo $this->params->get("columnLayout", "left-right"); ?>" >
        <div class="inside">
          <jdoc:include type="modules" name="right" style="xhtml" />
        </div>
      </div>
      <?php endif; ?>
      
      <div id="footer">
        <div class="inside">
          <jdoc:include type="modules" name="footer" style="xhtml" /> 
        </div>
      </div>      
    </div>
  <!--end of wrap-->
  </body>  
</html>



